<template>
	<view class="news-item">
		<view class="pic">
			<image :src="newsItem.picurl" mode="aspectFill"></image>
		</view>

		<view class="news-content">
			<view class="news-title">{{newsItem.title}}</view>
			<view class="news-bottom">

				<template v-if="!newsItem.lookTime">
					<view class="news-author">{{newsItem.author}}</view>
					<view class="news-hits">{{newsItem.hits}}浏览</view>
				</template>
				<template v-else>
					<view class="news-author">浏览时间：{{newsItem.lookTime}}</view>
				</template>
				
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "news-item",
		props: {
			newsItem: {
				type: Object,
				default () {
					return {}
				}
			}

		},
		data() {
			return {

			};
		}
	}
</script>

<style lang="scss">
	.news-item {
		display: flex;
		border-bottom: 1px solid #e1e1e1;
		padding: 24rpx 0;

		.pic {
			width: 230rpx;
			height: 170rpx;
			height: 160rpx;

			image {
				width: 100%;
				height: 100%;
				display: block;
			}
		}

		.news-content {
			display: flex;
			flex: 1;
			flex-direction: column;
			justify-content: space-between;
			// align-items: center;
			padding: 0rpx 0 0 16rpx;

			.news-title {
				font-size: 36rpx;
				
				text-overflow: -o-ellipsis-lastline;
				overflow: hidden; //溢出内容隐藏
				text-overflow: ellipsis; //文本溢出部分用省略号表示
				display: -webkit-box; //特别显示模式
				-webkit-line-clamp: 2; //行数
				line-clamp: 2;
				-webkit-box-orient: vertical; //盒子中内容竖直排列	
			}

			.news-bottom {
				display: flex;
				justify-content: space-between;
				color: #999;
				font-size: 28rpx;
			}
		}
	}
</style>